#ifndef BOXPROFILER_H_JM_20130301
#define BOXPROFILER_H_JM_20130301
// ## jm4bbx
#include "../common_bbx/timer/Timer.h"
// ## c++
#include <sstream>
#include <iostream>

namespace jm4bbx {

#ifdef NO_PROFILER
#define JM_BOX_PROFILER_START
#define JM_BOX_PROFILER_STOP 
#define JM_USE_SUM_BOX_PROFILER 
#define JM_SUM_BOX_PROFILER_START 
#define JM_SUM_BOX_PROFILER_STOP 
#else
#define JM_BOX_PROFILER_START PlainTimer profiler; profiler.start();

#define JM_BOX_PROFILER_STOP(L) auto profiler_t = profiler.meanTime();\
	LOG_E_EX(L, timeReportPrefix << ";" << getBoxClassType() << ";" \
		<< profiler_t.total_milliseconds());

#define JM_USE_SUM_BOX_PROFILER SumTimer profiler_;

#define JM_SUM_BOX_PROFILER_START  profiler_.start();

#define JM_SUM_BOX_PROFILER_STOP(L) auto profiler_t = profiler_.meanTime();\
	LOG_E_EX(L, timeReportPrefix << ";" << getBoxClassType() << ";" \
		<< profiler_t.total_milliseconds() << ";" \
		<< profiler_.getSumTime().total_milliseconds() << ";" \
		<< profiler_.getLapCount())
#endif

}	

#endif
